<!DOCTYPE html>
<html>

	<head>
		<meta charset="UTF-8">
		<title></title>
	</head>

	<body>

		<script type="text/javascript">
			var num, arr=[],cont=0;
			for(let i = 0; i < 5; i++) {
				num = Math.random() * 5;
				num = Math.floor(num);
				if(i == 0) {
					arr[i] = num
				} else {
					for(let j = 0; j < arr.length; j++) {
						if(num == arr[j]) {
							cont++
						}
					}
					if(cont<=0){
						arr[i]=num;
					}
					else{
						i--;
						cont=0;
					}
				}
				
				
			}
			console.log(arr)
		</script>
	</body>

</html>